﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Utility.Attributes
{
    /// <summary>
    /// 特性信息
    /// </summary>
    public class AttributeInfo<TAttribute>
        where TAttribute : Attribute, new()
    {
        /// <summary>
        /// 声明特性所在的类型
        /// </summary>
        public Type? DeclaringType { get; set; }

        /// <summary>
        /// 特性源名称 如：属性名称、字段名称
        /// </summary>
        public string? AttributeSourceName { get; set; }


        /// <summary>
        /// 特性源类别，参见：<see cref="AttributeSourceTypeEnum"/>
        /// </summary>
        public AttributeSourceTypeEnum? AttributeSourceType { get; set; }



        /// <summary>
        /// 特性
        /// </summary>
        public TAttribute? Attribute { get; set; }

        /// <summary>
        /// 特性名称
        /// </summary>
        public string? AttributeName { get; set; }
    }

    /// <summary>
    /// 特性源类别
    /// </summary>
    public enum AttributeSourceTypeEnum
    {
        /// <summary>
        /// 方法
        /// </summary>
        Method,

        /// <summary>
        /// 属性
        /// </summary>
        Property,

        /// <summary>
        /// 字段
        /// </summary>
        Field,
    }
}
